<?php
/**
 * oscshop2 B2C电子商务系统
 *
 * ==========================================================================
 * @link      http://www.oscshop.cn/
 * @copyright Copyright (c) 2015-2017 oscshop.cn. 
 * @license   http://www.oscshop.cn/license.html License
 * ==========================================================================
 *
 * @author   test
 *
 */
namespace osc\admin\controller;
use osc\common\controller\AdminBase;
use think\Db;
class Fin extends AdminBase{
	
	protected function _initialize(){
		parent::_initialize();
		$this->assign('breadcrumb1','财务管理');
		$this->assign('breadcrumb2','提现');		
	}

	function index()
	{


		$param=input('param.');
		
		$query=[];
		
		if(isset($param['user_name'])){		
			$map['m.username|m.nickname']=['like',"%".$param['user_name']."%"];
			$query['m.username']=urlencode($param['user_name']);
		}
		/*else{
			$map['m.uid']=['gt',0];
		}
		*/
		
		$list=[];
		
		$list=Db::name('goldstonewd')->alias('m')->field('m.*')->where('pay_status','0')
		->order('m.creat_time desc')->paginate(config('page_num'),false,$query);		
		
		$this->assign('list',$list);
				
		$this->assign('empty','<tr><td colspan="20">没有数据~</td></tr>');
		
    	return $this->fetch();



				//获取未提现的记录
		//$wd=Db::name('auth_group_access')->where('pay_status','1')->order('creat_time desc')->select();


		//return $this->fetch();
	}

	

	function isendwd()
	{
		$param=input('param.');
		
		$query=[];
		
		if(isset($param['user_name'])){		
			$map['m.username|m.nickname']=['like',"%".$param['user_name']."%"];
			$query['m.username']=urlencode($param['user_name']);
		}
		/*else{
			$map['m.uid']=['gt',0];
		}
		*/
		
		$list=[];
		
		$list=Db::name('goldstonewd')->alias('m')->field('m.*')->where('pay_status','1')
		->order('m.creat_time desc')->paginate(config('page_num'),false,$query);


		$this->assign('breadcrumb1','财务管理');
		$this->assign('breadcrumb2','已处理');			
		
		$this->assign('list',$list);
				
		$this->assign('empty','<tr><td colspan="20">没有数据~</td></tr>');
		
    	return $this->fetch();

	}

	function isprocing()
	{
		$param=input('param.');
		$this->assign('breadcrumb1','财务管理');
		$this->assign('breadcrumb2','正在处理');	
		
		$query=[];
		
		if(isset($param['user_name'])){		
			$map['m.username|m.nickname']=['like',"%".$param['user_name']."%"];
			$query['m.username']=urlencode($param['user_name']);
		}
		/*else{
			$map['m.uid']=['gt',0];
		}
		*/
		
		$list=[];
		
		$list=Db::name('goldstonewd')->alias('m')->field('m.*')->where('pay_status','3')
		->order('m.creat_time desc')->paginate(config('page_num'),false,$query);		
		
		$this->assign('list',$list);
				
		$this->assign('empty','<tr><td colspan="20">没有数据~</td></tr>');
		
    	return $this->fetch();

	}

	function iscancel()
	{
		$param=input('param.');
		$this->assign('breadcrumb1','财务管理');
		$this->assign('breadcrumb2','已取消');	
		
		$query=[];
		
		if(isset($param['user_name'])){		
			$map['m.username|m.nickname']=['like',"%".$param['user_name']."%"];
			$query['m.username']=urlencode($param['user_name']);
		}
		/*else{
			$map['m.uid']=['gt',0];
		}
		*/
		
		$list=[];
		
		$list=Db::name('goldstonewd')->alias('m')->field('m.*')->where('pay_status','2')
		->order('m.creat_time desc')->paginate(config('page_num'),false,$query);		
		
		$this->assign('list',$list);
				
		$this->assign('empty','<tr><td colspan="20">没有数据~</td></tr>');
		
    	return $this->fetch();
	}

	function pay()
	{
		$data=input('get.');
		if($data['token'])
		{
			Db::name('goldstonewd')->where('token',$data['token'])->update(['pay_status'=>'1']);
		}
		$this->redirect('fin/index');
	}


	


}
?>